Dasar-Dasar Teknik Prompt
Teknik Prompt (TP) adalah proses merancang dan mengoptimalkan masukan teks untuk membimbing Model Bahasa Besar (LLM) menuju hasil yang berkualitas tinggi dan konsisten.
1. Menentukan Antarmuka
Apa: Ini berfungsi sebagai antarmuka "pemrograman" utama untuk kecerdasan buatan generatif.
Mengapa: Ini menggeser interaksi dari prediksi teks yang kasar dan tidak terduga menjadi pelaksanaan instruksi yang sengaja dan terstruktur.
2. Dasar Model
- LLM Dasar: Dilatih hanya untuk memprediksi token berikutnya berdasarkan hubungan statistik dalam dataset besar, dengan memaksimalkan probabilitas $P(w_t | w_1, w_2, ..., w_{t-1})$.
- LLM yang Disesuaikan Instruksi: Disempurnakan melalui Pembelajaran Penguatan dengan Umpan Balik Manusia (RLHF) agar secara eksplisit mengikuti arahan tertentu dan bertindak sebagai asisten yang membantu.
3. Anatomis Prompt yang Sukses
Bagaimana: Prompt yang kuat biasanya mencakup:
- Instruksi: Tindakan spesifik yang diperlukan.
- Konten Utama: Data tujuan yang perlu diproses.
- Konten Sekunder: Parameter, format, atau batasan (untuk menangani stokastisitas dan halusinasi).
Realitas Tokenisasi
Model tidak membaca kata-kata; mereka memproses tokenโsatuan-satuan kecil dari urutan teks yang digunakan untuk menghitung probabilitas statistik.
TERMINALbash โ 80x24
> Ready. Click "Run" to execute.
>
Question 1
What is the primary difference between a Base LLM and an Instruction-Tuned LLM?
Question 2
Why is the use of delimiters (like triple backticks or hashes) considered a best practice in prompt engineering?
Challenge: Tutor AI Constraints
Refining prompts for educational safety.
You are building a tutor-style AI for a startup. The model is currently giving away answers too quickly and sometimes making up facts when it doesn't know the answer.
Task 1
Implement "Chain-of-thought" prompting in the system message to prevent the AI from giving away answers immediately.
Solution:
Instruct the model to:
Instruct the model to:
"Work through the problem step-by-step before providing the final answer. Do not reveal the final answer until the student has attempted the steps."Task 2
Apply an "out" to prevent fabrications (hallucinations) when the AI doesn't know the answer.
Solution:
Add the explicit instruction:
Add the explicit instruction:
"If you do not know the answer based on the provided text or standard curriculum, state clearly that you do not know."